/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package isd.inventario.modelo;

import isd.general.modelo.GR_Auditoria;
import java.io.Serializable;
import java.math.BigDecimal;
import java.util.Date;
import javax.persistence.Column;
import javax.persistence.DiscriminatorColumn;
import javax.persistence.DiscriminatorType;
import javax.persistence.Embedded;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.IdClass;
import javax.persistence.Inheritance;
import javax.persistence.InheritanceType;
import javax.persistence.JoinColumn;
import javax.persistence.JoinColumns;
import javax.persistence.Lob;
import javax.persistence.ManyToOne;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;

/**
 *
 * @author ctrosch
 */
@Entity
@Table(name = "strmvi")
@Inheritance(strategy = InheritanceType.SINGLE_TABLE)
@DiscriminatorColumn(name = "OALIAS", discriminatorType = DiscriminatorType.STRING, length = 10)
@IdClass(ST_ItemMovimientoPK.class)
public abstract class ST_ItemMovimiento implements Serializable {
    private static final long serialVersionUID = 1L;

    @Id
    @Column(name = "STRMVI_MODFOR", nullable = false, length = 2)
    private String modfor;
    @Id
    @Column(name = "STRMVI_CODFOR", nullable = false, length = 6)
    private String codfor;
    @Id
    @Column(name = "STRMVI_NROFOR", nullable = false)
    private int nrofor;
    @Id
    @Column(name = "STRMVI_SUCURS", nullable = false, length = 6)
    private String sucurs;
    @Id
    @Column(name = "STRMVI_NROITM", nullable = false)
    private int nroitm;
    @Id
    @Column(name = "STRMVI_NROITD", nullable = false)
    private int nroitd;
    @Id
    @Column(name = "STRMVI_NIVEXP", nullable = false, length = 2)
    private String nivexp;
    @Id
    @Column(name = "STRMVI_DEPOSI", nullable = false, length = 15)
    private String deposi;
    @Id
    @Column(name = "STRMVI_SECTOR", nullable = false, length = 15)
    private String sector;
    @Id
    @Column(name = "STRMVI_NSERIE", nullable = false, length = 30)
    private String nserie;
    @Id
    @Column(name = "STRMVI_NDESPA", nullable = false, length = 30)
    private String ndespa;
    @Id
    @Column(name = "STRMVI_ENVASE", nullable = false, length = 30)
    private String envase;
    @Id
    @Column(name = "STRMVI_NOTROS", nullable = false, length = 30)
    private String notros;

    @JoinColumns({
    @JoinColumn(name = "STRMVI_MODFOR", referencedColumnName = "STRMVH_MODFOR", nullable = false, insertable=false, updatable=false),
    @JoinColumn(name = "STRMVI_CODFOR", referencedColumnName = "STRMVH_CODFOR", nullable = false, insertable=false, updatable=false),
    @JoinColumn(name = "STRMVI_NROFOR", referencedColumnName = "STRMVH_NROFOR", nullable = false, insertable=false, updatable=false),
    @JoinColumn(name = "STRMVI_SUCURS", referencedColumnName = "STRMVH_SUCURS", nullable = false, insertable=false, updatable=false)
    })
    @ManyToOne
    private ST_Movimiento movimiento;


//
//    /**
//      * Deposito para transferencia
//      */
//    @JoinColumn(name = "STRMVI_DEPTRA", referencedColumnName = "STTDEH_DEPOSI", nullable = true, insertable=false, updatable=false)
//    @ManyToOne(optional=false)
//    private ST_Deposito depositoTransferencia;
//
//    /**
//     * Sector para transferencia
//     */
//    @JoinColumns({
//        @JoinColumn(name = "STRMVI_DEPTRA", referencedColumnName = "STTDEI_DEPOSI", nullable = false),
//        @JoinColumn(name = "STRMVI_SECTRA", referencedColumnName = "STTDEI_SECTOR", nullable = false)
//    })
//    @ManyToOne
//    private ST_Sector sectorTransferencia;

    @Column(name = "STRMVI_FCHMOV")
    @Temporal(TemporalType.TIMESTAMP)
    private Date fchmov;

    @JoinColumns({
    @JoinColumn(name = "STRMVI_TIPORI", referencedColumnName = "STMPDH_TIPPRO", nullable = false),
    @JoinColumn(name = "STRMVI_ARTORI", referencedColumnName = "STMPDH_ARTCOD", nullable = false)
    })
    @ManyToOne(optional=false)
    private ST_Producto producto;

    @Column(name = "STRMVI_NFECHA", length = 30)
    private String nfecha;
    @Column(name = "STRMVI_NATRIB", length = 30)
    private String natrib;
    @Column(name = "STRMVI_NUBICA", length = 30)
    private String nubica;
    @Column(name = "STRMVI_NESTAN", length = 30)
    private String nestan;

    @Column(name = "STRMVI_TSERIE", length = 30)
    private String tserie;
    @Column(name = "STRMVI_TDESPA", length = 30)
    private String tdespa;
    @Column(name = "STRMVI_TENVAS", length = 30)
    private String tenvas;
    @Column(name = "STRMVI_TOTROS", length = 30)
    private String totros;
    @Column(name = "STRMVI_TFECHA", length = 30)
    private String tfecha;
    @Column(name = "STRMVI_TATRIB", length = 30)
    private String tatrib;
    @Column(name = "STRMVI_TUBICA", length = 30)
    private String tubica;
    @Column(name = "STRMVI_TESTAN", length = 30)
    private String testan;

    @Column(name = "STRMVI_CANTID", precision = 18, scale = 4)
    private BigDecimal cantid;
    @Column(name = "STRMVI_CNTSEC", precision = 18, scale = 4)
    private BigDecimal cntsec;
    @Column(name = "STRMVI_STOCKS", precision = 18, scale = 4)
    private BigDecimal stocks;
    @Column(name = "STRMVI_PRECIO", precision = 20, scale = 6)
    private BigDecimal precio;

    /**
     * Observaciones
     */
    @Lob
    @Column(name = "STRMVI_TEXTOS", length = 65535)
    private String textos;
   
    @Column(name = "STRMVI_NROSEQ")
    private Integer nroseq;

    @JoinColumns({
    @JoinColumn(name = "STRMVI_TIPPRO", referencedColumnName = "STMPDH_TIPPRO", nullable = false),
    @JoinColumn(name = "STRMVI_ARTCOD", referencedColumnName = "STMPDH_ARTCOD", nullable = false)
    })
    @ManyToOne(optional=false)
    private ST_Producto productoPRD;


    @Column(name = "STRMVI_COFLIS", length = 6)
    private String coflis;
    @Column(name = "STRMVI_CAMBIO", precision = 20, scale = 8)
    private BigDecimal cambio;
    @Column(name = "STRMVI_PREEXT", precision = 20, scale = 6)
    private BigDecimal preext;
    @Column(name = "STRMVI_TIPOPR", length = 6)
    private String tipopr;
    @Column(name = "STRMVI_CODOPR", length = 30)
    private String codopr;
    @Column(name = "STRMVI_HORMOV", length = 10)
    private String hormov;
    @Column(name = "STRMVI_MODULE", length = 10)
    private String module;

    @Embedded
    private GR_Auditoria auditoria;

    /**
    @Column(name = "STRMVI_TSTAMP")
    @Temporal(TemporalType.TIMESTAMP)
    private Date tstamp;
    @Column(name = "STRMVI_LOTTRA", length = 6)
    private String lottra;
    @Column(name = "STRMVI_LOTREC", length = 6)
    private String lotrec;
    @Column(name = "STRMVI_LOTORI", length = 6)
    private String lotori;
    @Column(name = "STRMVI_SYSVER", length = 10)
    private String sysver;
    @Column(name = "STRMVI_CMPVER", length = 10)
    private String cmpver;
     * */

    public ST_ItemMovimiento() {
    }

    public ST_ItemMovimiento(String modfor, String codfor, int nrofor, String sucurs, int nroitm, int nroitd, String nivexp, String deposi, String sector, String nserie, String ndespa, String notros) {
        this.modfor = modfor;
        this.codfor = codfor;
        this.nrofor = nrofor;
        this.sucurs = sucurs;
        this.nroitm = nroitm;
        this.nroitd = nroitd;
        this.nivexp = nivexp;
        this.deposi = deposi;
        this.sector = sector;
        this.nserie = nserie;
        this.ndespa = ndespa;
        this.notros = notros;
    }

    public BigDecimal getCambio() {
        return cambio;
    }

    public void setCambio(BigDecimal cambio) {
        this.cambio = cambio;
    }

    public BigDecimal getCantid() {
        return cantid;
    }

    public void setCantid(BigDecimal cantid) {
        this.cantid = cantid;
    }

    public BigDecimal getCntsec() {
        return cntsec;
    }

    public void setCntsec(BigDecimal cntsec) {
        this.cntsec = cntsec;
    }

    public GR_Auditoria getAuditoria() {
        return auditoria;
    }

    public void setAuditoria(GR_Auditoria auditoria) {
        this.auditoria = auditoria;
    }

    public String getCodfor() {
        return codfor;
    }

    public void setCodfor(String codfor) {
        this.codfor = codfor;
    }

    public String getCodopr() {
        return codopr;
    }

    public void setCodopr(String codopr) {
        this.codopr = codopr;
    }

    public String getCoflis() {
        return coflis;
    }

    public void setCoflis(String coflis) {
        this.coflis = coflis;
    }

    public String getDeposi() {
        return deposi;
    }

    public void setDeposi(String deposi) {
        this.deposi = deposi;
    }

    public String getEnvase() {
        return envase;
    }

    public void setEnvase(String envase) {
        this.envase = envase;
    }

    public Date getFchmov() {
        return fchmov;
    }

    public void setFchmov(Date fchmov) {
        this.fchmov = fchmov;
    }

    public String getHormov() {
        return hormov;
    }

    public void setHormov(String hormov) {
        this.hormov = hormov;
    }

    public String getModfor() {
        return modfor;
    }

    public void setModfor(String modfor) {
        this.modfor = modfor;
    }

    public String getModule() {
        return module;
    }

    public void setModule(String module) {
        this.module = module;
    }

    public String getNatrib() {
        return natrib;
    }

    public void setNatrib(String natrib) {
        this.natrib = natrib;
    }

    public String getNdespa() {
        return ndespa;
    }

    public void setNdespa(String ndespa) {
        this.ndespa = ndespa;
    }

    public String getNestan() {
        return nestan;
    }

    public void setNestan(String nestan) {
        this.nestan = nestan;
    }

    public String getNfecha() {
        return nfecha;
    }

    public void setNfecha(String nfecha) {
        this.nfecha = nfecha;
    }

    public String getNivexp() {
        return nivexp;
    }

    public void setNivexp(String nivexp) {
        this.nivexp = nivexp;
    }

    public String getNotros() {
        return notros;
    }

    public void setNotros(String notros) {
        this.notros = notros;
    }

    public int getNrofor() {
        return nrofor;
    }

    public void setNrofor(int nrofor) {
        this.nrofor = nrofor;
    }

    public int getNroitd() {
        return nroitd;
    }

    public void setNroitd(int nroitd) {
        this.nroitd = nroitd;
    }

    public int getNroitm() {
        return nroitm;
    }

    public void setNroitm(int nroitm) {
        this.nroitm = nroitm;
    }

    public Integer getNroseq() {
        return nroseq;
    }

    public void setNroseq(Integer nroseq) {
        this.nroseq = nroseq;
    }

    public String getNserie() {
        return nserie;
    }

    public void setNserie(String nserie) {
        this.nserie = nserie;
    }

    public String getNubica() {
        return nubica;
    }

    public void setNubica(String nubica) {
        this.nubica = nubica;
    }

    public BigDecimal getPrecio() {
        return precio;
    }

    public void setPrecio(BigDecimal precio) {
        this.precio = precio;
    }

    public BigDecimal getPreext() {
        return preext;
    }

    public void setPreext(BigDecimal preext) {
        this.preext = preext;
    }

    public String getSector() {
        return sector;
    }

    public void setSector(String sector) {
        this.sector = sector;
    }

    public BigDecimal getStocks() {
        return stocks;
    }

    public void setStocks(BigDecimal stocks) {
        this.stocks = stocks;
    }

    public String getSucurs() {
        return sucurs;
    }

    public void setSucurs(String sucurs) {
        this.sucurs = sucurs;
    }

    public String getTatrib() {
        return tatrib;
    }

    public void setTatrib(String tatrib) {
        this.tatrib = tatrib;
    }

    public String getTdespa() {
        return tdespa;
    }

    public void setTdespa(String tdespa) {
        this.tdespa = tdespa;
    }

    public String getTenvas() {
        return tenvas;
    }

    public void setTenvas(String tenvas) {
        this.tenvas = tenvas;
    }

    public String getTestan() {
        return testan;
    }

    public void setTestan(String testan) {
        this.testan = testan;
    }

    public String getTextos() {
        return textos;
    }

    public void setTextos(String textos) {
        this.textos = textos;
    }

    public String getTfecha() {
        return tfecha;
    }

    public void setTfecha(String tfecha) {
        this.tfecha = tfecha;
    }

    public String getTipopr() {
        return tipopr;
    }

    public void setTipopr(String tipopr) {
        this.tipopr = tipopr;
    }

    public ST_Producto getProductoPRD() {
        return productoPRD;
    }

    public void setProductoPRD(ST_Producto productoPRD) {
        this.productoPRD = productoPRD;
    }
    
    public String getTotros() {
        return totros;
    }

    public void setTotros(String totros) {
        this.totros = totros;
    }

    public String getTserie() {
        return tserie;
    }

    public void setTserie(String tserie) {
        this.tserie = tserie;
    }

    public String getTubica() {
        return tubica;
    }

    public void setTubica(String tubica) {
        this.tubica = tubica;
    }

    public ST_Producto getProducto() {
        return producto;
    }

    public void setProducto(ST_Producto producto) {
        this.producto = producto;
    }


    public ST_Movimiento getMovimiento() {
        return movimiento;
    }

    public void setMovimiento(ST_Movimiento movimiento) {
        this.movimiento = movimiento;
    }

    
    
    @Override
    public boolean equals(Object obj) {
        if (obj == null) {
            return false;
        }
        if (getClass() != obj.getClass()) {
            return false;
        }
        final ST_ItemMovimiento other = (ST_ItemMovimiento) obj;
        if ((this.modfor == null) ? (other.modfor != null) : !this.modfor.equals(other.modfor)) {
            return false;
        }
        if ((this.codfor == null) ? (other.codfor != null) : !this.codfor.equals(other.codfor)) {
            return false;
        }
        if (this.nrofor != other.nrofor) {
            return false;
        }
        if ((this.sucurs == null) ? (other.sucurs != null) : !this.sucurs.equals(other.sucurs)) {
            return false;
        }
        if (this.nroitm != other.nroitm) {
            return false;
        }
        if ((this.nivexp == null) ? (other.nivexp != null) : !this.nivexp.equals(other.nivexp)) {
            return false;
        }
        if ((this.deposi == null) ? (other.deposi != null) : !this.deposi.equals(other.deposi)) {
            return false;
        }
        if ((this.sector == null) ? (other.sector != null) : !this.sector.equals(other.sector)) {
            return false;
        }
        if ((this.nserie == null) ? (other.nserie != null) : !this.nserie.equals(other.nserie)) {
            return false;
        }
        if ((this.ndespa == null) ? (other.ndespa != null) : !this.ndespa.equals(other.ndespa)) {
            return false;
        }
        if ((this.envase == null) ? (other.envase != null) : !this.envase.equals(other.envase)) {
            return false;
        }
        if ((this.notros == null) ? (other.notros != null) : !this.notros.equals(other.notros)) {
            return false;
        }
        return true;
    }

    @Override
    public int hashCode() {
        int hash = 3;
        hash = 89 * hash + (this.modfor != null ? this.modfor.hashCode() : 0);
        hash = 89 * hash + (this.codfor != null ? this.codfor.hashCode() : 0);
        hash = 89 * hash + this.nrofor;
        hash = 89 * hash + (this.sucurs != null ? this.sucurs.hashCode() : 0);
        hash = 89 * hash + this.nroitm;
        hash = 89 * hash + this.nroitd;
        hash = 89 * hash + (this.nivexp != null ? this.nivexp.hashCode() : 0);
        hash = 89 * hash + (this.deposi != null ? this.deposi.hashCode() : 0);
        hash = 89 * hash + (this.sector != null ? this.sector.hashCode() : 0);
        hash = 89 * hash + (this.nserie != null ? this.nserie.hashCode() : 0);
        hash = 89 * hash + (this.ndespa != null ? this.ndespa.hashCode() : 0);
        hash = 89 * hash + (this.envase != null ? this.envase.hashCode() : 0);
        hash = 89 * hash + (this.notros != null ? this.notros.hashCode() : 0);
        return hash;
    }

    @Override
    public String toString() {
        return "ST_ItemMovimiento{" + "modfor=" + modfor + "codfor=" + codfor + "nrofor=" + nrofor + "sucurs=" + sucurs + "nroitm=" + nroitm + "nroitd=" + nroitd + "nivexp=" + nivexp + "deposi=" + deposi + "sector=" + sector + "nserie=" + nserie + "ndespa=" + ndespa + "envase=" + envase + "notros=" + notros + '}';
    }

}
